package com.sure.yyr.info.customer.impl;

import com.sure.yyr.common.Utils;
import com.sure.yyr.info.customer.CustomerDto;
import com.sure.yyr.info.customer.CustomerService;
import com.sure.yyr.info.customer.dao.CustomerDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Map;

@Service @Transactional
public class CustomerServiceImpl implements CustomerService {

    @Resource
    private CustomerDao customerDao;

    @Override
    public Map<String, Object> getCustomerList(CustomerDto dto) {
        return Utils.getPage(dto, ()-> customerDao.findCustomerList(dto));
    }

    @Override
    public void addCustomer(CustomerDto dto) {
        customerDao.insertCustomer(dto);
    }

    @Override
    public void deleteCustomer(Integer id) {
        customerDao.deleteCustomer(id);
    }
}
